{extend name="member/common/login_layout" /}

{block name="content"}

<div class="nc-login-layout">
    <div class="left-pic"> <img src="<?php echo $lpic;?>"  border="0"> </div>
    <div class="nc-login">
        <div class="arrow"></div>
        <div class="nc-password-mode">
            <ul class="tabs-nav">
               <!--  <li><a href="#default">忘记密码<i></i></a></li> -->
               <!--  <?php if (sysconf('sms_password') == 0){?> -->
                <li><a href="#mobile" title="手机找回密码" class="sms_find">手机找回密码<i></i></a></li>
                <!-- <?php } ?> -->
            </ul>
            <div id="tabs_container" class="tabs-container">
        <!--         <div id="default" class="tabs-content">
            <form class="nc-login-form layui-form" action="" method="POST" id="find_password_form">
        
        
                <dl>
                    <dt>登录账号：</dt>
                    <dd>
                        <input type="text" class="text" lay-verify="username" name="username" tipMsg="输入您已注册的用户名" />
                    </dd>
                </dl>
                <dl>
                    <dt>电子邮箱：</dt>
                    <dd>
                        <input type="text" class="text" lay-verify="email" name="email" tipMsg="输入您已注册的邮箱" />
                    </dd>
                </dl>
                <div class="code-div mt15">
                    <dl>
                        <dt>验证码：</dt>
                        <dd>
                            <input type="text" name="captcha" autocomplete="off" class="text w100" lay-verify="captcha" placeholder="输入验证码" id="captcha" size="10"/>
                        </dd>
                    </dl>
                    <span>
                        <img style="cursor: pointer; vertical-align: top;" onclick="this.src+='?rand='+Math.random();" src="{:url('verify_code')}" title="看不清？换一张" alt="captcha" />
                    </span>
                </div>
                <div class="submit-div">
                    <input type="button" class="submit" lay-submit="" lay-filter="ajax_email_find_pwd" value="重置密码" name="Submit" id="Submit">
                    <input type="hidden" value="<?php echo $ref_url?>" name="ref_url">
                </div>
            </form>
        </div> -->
              <!--   <?php if (sysconf('sms_password') == 0){?> -->
                <div id="mobile" class="tabs-content">
                    <form id="post_form" method="post" class="nc-login-form layui-form" action="">
                        <input type="hidden" name="find_type" value="mobile" />
                        <dl>
                            <dt>手机号：</dt>
                            <dd>
                                <input type="text" class="text" autocomplete="off" value="" name="phone" id="phone" tipMsg="输入您已注册的手机号" >
                            </dd>
                        </dl>
                        <div class="code-div">
                            <dl>
                                <dt>验证码：</dt>
                                <dd>
                                    <input type="text" name="captcha" class="text w100" lay-verify="captcha" id="image_captcha" size="10" tipMsg="输入验证码" />
                            </dl>
                            <span>
                                <img src="{:url('verify_code')}" title="看不清？换一张" name="codeimage" id="sms_codeimage"> <a class="makecode" href="javascript:void(0);" class="ml5" onclick="document.getElementById('sms_codeimage').src+='?rand='+Math.random();">看不清？换一张</a></span>
                            </dd>
                        </div>
                        <div class="tiptext" id="sms_text">正确输入上方验证码后，点击<span> <a href="javascript:void(0);"  onclick="get_sms_captcha('3')"><i class="icon-mobile-phone"></i>发送短信验证</a></span>，查收短信将系统发送的“6位手机验证码”输入到下方验证后登录。</div>
                        <dl>
                            <dt>短信验证：</dt>
                            <dd>
                                <input type="text" name="sms_captcha" autocomplete="off" class="text w100" id="sms_captcha" size="15"  tipMsg="输入验证码" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>新密码：</dt>
                            <dd>
                                <input type="text" name="password" id="password" class="text"  tipMsg="输入您修改的密码" />
                            </dd>
                        </dl>
                        <div class="submit-div">
                            <input type="submit" id="submit" class="submit" lay-submit="" lay-filter="ajax_mobile_find_pwd" value="确认重置">
                        </div>
                    </form>
                </div>
                <!-- <?php } ?> -->
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>

<script>
    $(function() {
        //初始化Input的灰色提示信息
        $('input[tipMsg]').inputTipText({pwd: 'password'});
        //找回密码方式切换
        $('.nc-password-mode').tabulous({
            effect: 'flip'//动画反转效果
        });
        var div_form = '#default';
        $(".nc-password-mode .tabs-nav li a").click(function () {
            if ($(this).attr("href") !== div_form) {
                div_form = $(this).attr('href');
                $("" + div_form).find(".makecode").trigger("click");
            }
        });
    });
</script>


<!-- layer 3.0 -->
<script src="__PUBLIC__/static/plugs/layer/layer.js"></script>

<!-- layui 2.0-->
<link rel="stylesheet" href="__PUBLIC__/static/plugs/layui/css/layui.css">
<script src="__PUBLIC__/static/plugs/layui/layui.js"></script>

<!-- popup js -->
<script language="javascript" src="__PUBLIC__/static/admin/js/popup.js" type="text/javascript"></script>



<script>
    $(function () {
        //初始化Input的灰色提示信息
        $('input[tipMsg]').inputTipText({pwd: 'password'});
        //登录方式切换
        $('.nc-login-mode').tabulous({
            effect: 'flip'//动画反转效果
        });
        var div_form = '#default';
        $(".nc-login-mode .tabs-nav li a").click(function () {
            if ($(this).attr("href") !== div_form) {
                div_form = $(this).attr('href');
                $("" + div_form).find(".makecode").trigger("click");
            }
        });

        // 勾选自动登录显示隐藏文字
        $('input[name="auto_login"]').click(function () {
            if ($(this).attr('checked')) {
                $(this).attr('checked', true).next().show();
            } else {
                $(this).attr('checked', false).next().hide();
            }
        });
    });
</script>

<script>
    function get_sms_captcha(){
        if($("#phone").val().length == 11){

            $.ajax({
                type: "GET",
                url: '{:url("member/Login/sendSms")}?type=find_password&mobile=' + $('#phone').val(),
                async: false,
                success: function(res){
                    if(res.state == 200) {
                        $("#sms_text").html('短信验证码已发出');
                    } else {
                        layer.msg(res.message, function(){});
                    }
                }
            });
        }
    }

</script>



<script>
    layui.use(['form'], function() {
        var form = layui.form;

        //自定义验证规则
        form.verify({
            username: function(value){
                if(value == '输入您已注册的用户名' || value.length < 1){
                    return '登录账号不能为空';
                }
            },

            captcha: function(value){
                if(value == '输入验证码'){
                    return '验证码不能为空';
                }
                if(value.length < 4){
                    return '验证码至少为4位';
                }
            }
        });

        // ajax 提交
        form.on('submit(ajax_mobile_find_pwd)', function(data){
            data.field.find_type = 'mobile';
            $.post('{:url("member/Login/find_password")}',data.field,function(res){

                popup_jump(res, 1);
            });
            return false;
        });

//        form.on('submit(ajax_mobile_login)', function(data){
//            data.field.find_type = 'mobile';
//            $.post('{:url("member/Login/index")}',data.field,function(res){
//
//                popup_jump(res, 1);
//            });
//            return false;
//        });
    });
</script>

{/block}